import type { CustomerData } from "../../types/DataTypes";
import { CustomerDAO } from "../../DAO";

export class CustomerService {
    // ==================== 客户操作 ====================

    // 新增客户
    static async addCustomer(customer: CustomerData): Promise<boolean> {
        return CustomerDAO.addCustomer(customer);
    }

    // 获取所有客户
    static async getAllCustomers(): Promise<CustomerData[]> {
        return CustomerDAO.getAllCustomers();
    }

    // 根据客户名模糊查询客户
    static async searchCustomersByName(customerName: string): Promise<CustomerData[]> {
        return CustomerDAO.searchCustomersByName(customerName);
    }

    // 根据客户ID精确查询客户
 /*   static async searchCustomersById(customerId: string): Promise<CustomerData[]> {
        return CustomerDAO.searchCustomersById(customerId);
    }*/

    // 更新客户数据
    static async updateCustomer(customerData: CustomerData): Promise<boolean> {
        return CustomerDAO.updateCustomer(customerData);
    }

    // 删除客户
    static async deleteCustomer(customerId: string): Promise<boolean> {
        return CustomerDAO.deleteCustomer(customerId);
    }

    // 检查客户是否存在
    /*static async customerExists(customerId: string): Promise<boolean> {
        return CustomerDAO.customerExists(customerId);
    }*/

    // 检查客户名是否存在
    static async customerNameExists(customerName: string): Promise<boolean> {
        return CustomerDAO.customerNameExists(customerName);
    }

    // 用户登陆验证
    static async verify(customerName:string,customerID:string): Promise<boolean> {
        return CustomerDAO.verify(customerName, customerID);
    }

    // 高级搜索（支持多个条件组合）
    /* static async advancedSearch(criteria: {
        customerName?: string;
        customerId?: string;
    }): Promise<CustomerData[]> {
        return CustomerDAO.advancedSearch(criteria);
    }*/
}